package com.honey.standard.writer.imp;

import java.io.File;
import java.util.Date;
import java.util.Properties;

import com.honey.compilation.xml.XmlCompilation;
import com.honey.core.compiler.CompilationDescriptor;
import com.honey.core.utils.Constant;
import com.honey.core.utils.TimeUtility;
import com.honey.standard.writer.StandardWriterPlugin;
import com.honey.standard.writer.XmlFileWrite;

public class XmlFileWriteImp  extends BaseFileWriter  implements XmlFileWrite{

	public XmlFileWriteImp(StandardWriterPlugin standardWriterPlugin) {
		super(standardWriterPlugin);
	}

	@Override
	public void writeXmlFile(CompilationDescriptor compilationDescriptor) {
		XmlCompilation compilation =(XmlCompilation)compilationDescriptor.getCompilation();
		Properties props=System.getProperties();
		compilation.addFileComment("Generate Date : " + TimeUtility.format(new Date(), TimeUtility.FORMAT_DATE_ONLY));
		compilation.addFileComment("Generate Version : " + Constant.VERSION );
		compilation.addFileComment("Generate Name : " + Constant.PROJECT_NAME );
		compilation.addFileComment("Generate User : " + props.getProperty("user.name"));
		compilation.addFileComment("JDK Version : " + Constant.SINCE );
		super.writeFile(compilationDescriptor);
	}
	
	@Override
	public File getTargetFile() {
		
		return super.getTargetFile();
	}	
}
